package spill;

import java.awt.Graphics;
import java.awt.Graphics2D;

public class Money extends Item {
	private double theta;
	private long time;
	public Money(Engine e) {//used to create template
		super("Graphics/moneyC.txt", "Graphics/moneyD.txt", e);
		y = 100;
		theta = 0;
		time = (long)(Math.random()*100);
	}
	public Money(Money template, Engine e) {
		super(template.getDesign(), template.getColor(), e);
		y = template.getY() + (int)(Math.random()*30);
		theta = 0;
		time = (long)(Math.random()*100);
	}
	public void move() {
		x = x+(int)Math.random()*3;
		y++;
		time++;
		theta += Math.sin(time*0.06)/250;
	}
	public int getMidX() {
		return x+31;
	}
	public int getMidY() {
		return y+15;
	}
	public void draw(Graphics g) {
		Graphics2D g2d = (Graphics2D) g.create();
		g2d.rotate(theta, getMidX(), y-50);
		super.draw(g2d);
		g2d.dispose();
	}
}
